package com.yc.springcloudindex;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//启动配置上检查是否有@EnableFeignClients 注解，如果有该注解，则开启包扫描
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class SpringCloudIndexApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringCloudIndexApplication.class, args);
    }


    //负载均衡
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

}
